<template>
    <div id="dialog-container">
        <el-dialog v-dialogDrag 
            title="指派任务单" append-to-body
            :visible.sync="dialogVisible" @close="$emit('update:show', false)" :before-close="handleClose" :show="show"
            :close-on-click-modal="false" width="400px">
            <el-row class="searchBox">
                <el-form :inline="true" size="small" label-width="120px">
                    <el-form-item label="任务单号：">
                        <el-input size="small" disabled></el-input>
                    </el-form-item>
                    <el-form-item label="统一编号：">
                        <el-select v-model="numberVal" placeholder="请选择" style="width: 200px;">
                            <el-option v-for="item in number" :key="item.value" :label="item.label" :value="item.value"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="委托单位：">
                        <el-input size="small" disabled></el-input>
                    </el-form-item>
                    <el-form-item label="委托日期：">
                        <el-input size="small" disabled></el-input>
                    </el-form-item>
                    <el-form-item label="委托人：">
                        <el-input size="small" disabled></el-input>
                    </el-form-item>
                    <el-form-item label="指派人工号：">
                        <el-input size="small" v-model="staff" disabled style="width: 200px;">
                            <el-button slot="append" @click="choosePeopleInfo">选择</el-button>
                        </el-input>
                    </el-form-item>
                    <el-form-item label="指派人姓名：">
                        <el-input size="small" disabled></el-input>
                    </el-form-item>
                </el-form>
            </el-row>
            <!-- 选择用户 -->
            <choose-user :show.sync="showChoose" @chooseAccount="staffInfo"></choose-user>

            <div slot="footer" class="dialog-footer">
                <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
                <el-button @click="dialogVisible = false">取 消</el-button>
            </div>
        </el-dialog>
    </div>
</template>

<script>
    import ChooseUser from 'dialog/system-manage/week-check-manage/choose-user';
    export default {
        components: {
            'choose-user': ChooseUser
        },
        data() {
            return {
                dialogVisible: this.show,
                numberVal: '',
                number: [],
                showChoose: false,
                staff: ''
            }
        },
        props: {
            show: {
                type: Boolean,
                default: false
            }
        },
        watch: {
            show() {
                this.dialogVisible = this.show;
            }
        },
        methods: {
            handleClose() {
                this.dialogVisible = false;
            },
            // 选择人员信息
            choosePeopleInfo() {
                this.showChoose = true;
            },
            // 获取选择的人员信息
            staffInfo(...data) {
                this.staff = data.toString();
            }
        }
    }
</script>